<template>
  <div class="gotop">
    <div @click="goTop">
      <van-icon name="back-top" size="20" />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    goTop() {
      document.documentElement.scrollTop = 0;
    },
  },
};
</script>

<style lang="scss">
.gotop {
  div {
    position: fixed;
    bottom: 70px;
    right: 20px;
    border: 1px solid #888;
    background-color: #fff;
    border-radius: 50%;
    opacity: 0.5;
    padding: 5px;

    &:active {
      opacity: 1;
    }
  }
}
</style>